public class Parent {
    public synchronized void syncMethod() {
        System.out.println("Parent start"+Thread.currentThread().getId());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("Parent end"+Thread.currentThread().getId());
    }
}

